<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="com.lp.cfg.ProConfig"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html>
<html>
<head>
<%@ include file="/WEB-INF/oss/iot/common/variable.jsp"%>
<%@ include file="/WEB-INF/oss/iot/common/variable_js.jsp"%>
<%@ include file="/WEB-INF/oss/iot/common/resource_lib.jsp"%>
<link type="text/css" href="<%=basePath%>/css/oss/iot/alarm_manager.css?<%=v%>" rel="stylesheet"/>
<style type="text/css">

</style>
</head>
<body>
	<div>
		<!--  下方部位  -->
		<div style="background: #ecf0f5;">
			<div class="mapContainer" >
				<div class="app-container">
					<div class="container-layout sceneList-info">
						<div class="box join-device-box">
							<div class="search-container" type-option="search_table" config-option=" submit:'#searchbtns',table:'#init-table'">
									<span>Project Name:</span>
									<select type-name="scene_id" style="width: 240px;" class="input input-select input-self">
										<option value="">Select item</option>
										<c:forEach items="${info.data.getData()}" varStatus="status" var="obj">
											<option value="${obj.id}">${obj.name }</option>
										</c:forEach>
									</select>
									<!-- <span class="ml-10">传感器名称：</span> 
									<input type-name="sensor_name"   class="input input-self" /> -->
									<span class="ml-10">Alarm level:</span>
									<select type-name="iot_trigger_alarm_level"  type-option="selecter" style="width: 240px;"
										config-option=" method:'GET','url':'/dictionary/38','key':'code','value':'name',
										'type':'list' ,init_value:'Select alarm level'  "   class="input input-select input-self" ></select>
									
									<span class="ml-10 ml-10-r">Time interval:</span>
									<input type-name="start_time"   class="input jui-time start_time" data-options="defaultValue:-7" />
									<span>~</span>
									<input type-name="end_time"   class="input jui-time end_time" data-options="" />
									<button id="searchbtns" class="button ml-20 bg-iot float-right"><span class="icon-search"></span> inquire</button>
							</div>
							
							<div id="init-table" class="jui-table" config-option="url:'/page/alarm',
										 param:{ start_time:'$.start_time$',end_time:'$.end_time$' },
										 columns:[
											{name:'Serial number','type':'seq','value':'seq','width':'8%'}, 
											{name:'Alarm name','value':'name','width':'9%'}, 
											{name:'Alarm details','value':'description','width':'22%',limit:26},
											{name:'Alarm contact','value':'{contact_names}','width':'13%'},
											{name:'Alarm level','type':'category','value':'iot_trigger_alarm_level','width':'6%',style:{39:'color,#e33',40:'color,#CD5C5C',41:'#FF7F50' } }, 
											{name:'Processing flag','type':'category','value':'iot_alarm_process_status','width':'7%',style:{47:'color,#A9A9A9',48:'color,#FF7F50',46:'color,#e33' }},
											{name:'time','type':'time','value':'atime','width':'10%'},
											{ name:'Controls', type:'self', value_callback :'value_function','width':'5%'}]" > 
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</body>
<script type="text/javascript">
function value_function(data,seq){
	<c:if test="${user.type == 10 || user.type == 8 }">
	return "<span tag='删除' onclick='t_delete(this,"+data.id+")' class='self-icon icon-bitbucket'></span>";
	</c:if>
}
function t_delete(obj,i){
	lcomfirm('Are you sure to delete the alarm information?',function(){
	 	commonAjax("DELETE",localUrl+"/alarm?id="+i, '',function(data){
	 		if(isOK(data)){
		 		tip("Successfully deleted");
		 		setTimeout(function(){
		 			$("#init-table").tableAdaptor();
		 		},1000);	 			
	 		}
	 	});
	})
}
$(function(){
	$(document).delegate(".limiter","click",function(){
		layer.tips($(this).attr("tag") , this, {
			tips: [1, '#4682B4']
		});
	})
})
</script>
</html>